﻿[assembly:
        System.Web.UI.WebResource("BM.Tools.WebControls.MForm.Controls.ValueHandlers.InputsContainerValueHandler.js",
                "application/x-javascript")]
[assembly:
        System.Web.UI.WebResource("BM.Tools.WebControls.MForm.Controls.ValueHandlers.InputsContainerValueHandler.debug.js",
                "application/x-javascript")]
[assembly:
        System.Web.UI.WebResource("BM.Tools.WebControls.MForm.Controls.ValueHandlers.RadioButtonListValueHandler.js",
                "application/x-javascript")]
[assembly:
        System.Web.UI.WebResource("BM.Tools.WebControls.MForm.Controls.ValueHandlers.RadioButtonListValueHandler.debug.js",
                "application/x-javascript")]

namespace BM.Tools.WebControls.MForm.Controls.ValueHandlers
{
    using System.Web.UI;
    using System.Web.UI.WebControls;

    using AjaxControlToolkit;

    using BM.Tools.WebControls.MForm.Controls.Items;

    /// <summary>
    /// A control that binds the <see cref="LeafItem" /> control with a <see cref="RadioButtonList" /> control.
    /// </summary>
    [ClientScriptResource("BM.Tools.WebControls.MForm",
            "BM.Tools.WebControls.MForm.Controls.ValueHandlers.InputsContainerValueHandler.js", LoadOrder = 0)]
    [ClientScriptResource("BM.Tools.WebControls.MForm",
            "BM.Tools.WebControls.MForm.Controls.ValueHandlers.RadioButtonListValueHandler.js", LoadOrder = 1)]
    public class RadioButtonListValueHandler : ListControlValueHandler<RadioButtonList>
    {
        /// <summary>
        /// Gets or sets RadioButtonList.
        /// </summary>
        /// <value>
        /// The radio button list.
        /// </value>
        [PersistenceMode(PersistenceMode.InnerProperty)]
        public RadioButtonList RadioButtonList
        {
            get
            {
                return Control;
            }

            set
            {
                Control = value;
            }
        }

        /// <summary>
        /// adds css class to the item
        /// </summary>
        /// <param name="item">
        /// The list item.
        /// </param>
        protected override void PrepareItem(ListItem item)
        {
            item.Attributes["class"] = "Radio";
        }
    }
}